﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VRacer;
using System.Windows;

namespace VRacerServer
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            Console.WriteLine("VRacer server v0.0.1 is starting...\n");
            var game = new ServerGame();

            Console.WriteLine("Loading tracks...");

            foreach (var track in game.Tracks)
                Console.WriteLine("  {0} ({1}) loaded", track.Title, track.ContainingDirectory);

            Console.WriteLine("\nLoading complete\nInitializing...\n");

            try
            {
                game.Initialize();
                Console.WriteLine(" Port: {0}", game.Port);
                Console.WriteLine(" Map: {0}", game.CurrentTrack.Title);
                Console.WriteLine("\nAwaiting connection\n", game.Port);
                new Application().Run();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e.Message);
            }
            Console.ReadLine();
        }
    }
}
